/*
*********************************************************************************************************
*                                            EXAMPLE CODE
*
*               This file is provided as an example on how to use Micrium products.
*
*               Please feel free to use any application code labeled as 'EXAMPLE CODE' in
*               your application products.  Example code may be used as is, in whole or in
*               part, or may be used as a reference only. This file can be modified as
*               required to meet the end-product requirements.
*
*               Please help us continue to provide the Embedded community with the finest
*               software available.  Your honesty is greatly appreciated.
*
*               You can find our product's user manual, API reference, release notes and
*               more information at https://doc.micrium.com.
*               You can contact us at www.micrium.com.
*********************************************************************************************************
*/

/*
*********************************************************************************************************
*
*                                      APPLICATION CONFIGURATION
*
*                                     ST Microelectronics STM32
*                                              on the
*
*                                           STM3240G-EVAL
*                                         Evaluation Board
*
* Filename      : app_cfg.h
* Version       : V1.00
* Programmer(s) : DC
*********************************************************************************************************
*/

#ifndef  APP_CFG_MODULE_PRESENT
#define  APP_CFG_MODULE_PRESENT


/*
*********************************************************************************************************
*                                       MODULE ENABLE / DISABLE
*********************************************************************************************************
*/

#define  APP_CFG_SERIAL_EN                      DEF_DISABLED


/*
*********************************************************************************************************
*                                            TASK PRIORITIES
*********************************************************************************************************
*/

#define  APP_CFG_TASK_START_PRIO                 2u
#define  APP_CFG_TASK_OBJ0_PRIO                  7u
#define  APP_CFG_TASK_GUI_PRIO                  15u
#define  APP_TASK_KEYPAD_PRIO                    6u

/*
*********************************************************************************************************
*                                            TASK STACK SIZES
*                             Size of the task stacks (# of OS_STK entries)
*********************************************************************************************************
*/

#define  APP_CFG_TASK_START_STK_SIZE            512u
#define  APP_CFG_TASK_OBJ0_STK_SIZE             512u
#define  APP_CFG_TASK_GUI_STK_SIZE           2*1024u
#define  APP_TASK_KEYPAD_STK_SIZE               512u

/*
*********************************************************************************************************
*                                     TRACE / DEBUG CONFIGURATION
*********************************************************************************************************
*/

#ifndef  TRACE_LEVEL_OFF
#define  TRACE_LEVEL_OFF                          0u
#endif

#ifndef  TRACE_LEVEL_INFO
#define  TRACE_LEVEL_INFO                         1u
#endif

#ifndef  TRACE_LEVEL_DBG
#define  TRACE_LEVEL_DBG                          2u
#endif


#if (APP_CFG_SERIAL_EN == DEF_ENABLED)
#define  APP_TRACE_LEVEL                        TRACE_LEVEL_DBG
#else
#define  APP_TRACE_LEVEL                        TRACE_LEVEL_OFF
#endif
#define  APP_TRACE                              printf

#define  APP_TRACE_INFO(x)                     ((APP_TRACE_LEVEL >= TRACE_LEVEL_INFO)  ? (void)(APP_TRACE x) : (void)0)
#define  APP_TRACE_DBG(x)                      ((APP_TRACE_LEVEL >= TRACE_LEVEL_DBG)   ? (void)(APP_TRACE x) : (void)0)

//***************************PART1:ON/OFF define*******************************
#define OS_DEBUG_ON         		               0
#define OS_DEBUG_ARRAY_ON  			               0
#define OS_DEBUG_FUNC_ON   			               0
// Log define
#define OS_INFO(fmt,arg...)                    printf("<<-OS-INFO->> "fmt"\n",##arg)
#define OS_ERROR(fmt,arg...)                   printf("<<-OS-ERROR->> "fmt"\n",##arg)

#define OS_DEBUG(fmt,arg...)                   do{\
                                                  if(OS_DEBUG_ON)\
                                                  printf("<<-OS-DEBUG->> [%d]"fmt"\n",__LINE__, ##arg);\
                                               }while(0)
#define OS_DEBUG_ARRAY(array, num)             do{\
                                                  int32_t i;\
                                                  uint8_t* a = array;\
                                                  if(OS_DEBUG_ARRAY_ON)\
                                                  {\
                                                     printf("<<-OS-DEBUG-ARRAY->>\n");\
                                                     for (i = 0; i < (num); i++)\
                                                     {\
                                                       printf("%02x   ", (a)[i]);\
                                                       if ((i + 1 ) %10 == 0)\
                                                       {\
                                                         printf("\n");\
                                                       }\
                                                     }\
                                                    printf("\n");\
                                                  }\
                                               }while(0)
#define OS_DEBUG_FUNC()                        do{\
                                                  if(OS_DEBUG_FUNC_ON)\
                                                    printf("<<-OS-FUNC->> Func:%s@Line:%d\n",__func__,__LINE__);\
                                               }while(0)
#endif
